package cn.hongwei.eduservice.controller.api;


import cn.hongwei.eduservice.entity.EduTeacher;
import cn.hongwei.eduservice.service.EduTeacherService;
import cn.hongwei.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 讲师 前端控制器
 * </p>
 *
 * @author Great
 * @email 1224028994@qq.com
 */
@RestController
@CrossOrigin
@RequestMapping("/api/edu/teacher")
public class ApiTeacherController {
    @Autowired
    EduTeacherService teacherService;
    //2、查询讲师详情
    @GetMapping("getById/{id}")
    public R getById(@PathVariable String id){
        EduTeacher teacher = teacherService.getById(id);
        return R.ok().data("item",teacher);
    }
    //1、查询所有讲师列表
    // Linux切换路径: cd ~  进入当前用户的家目录
    @GetMapping("list")
    public R listAll(){
        List<EduTeacher> teachers = teacherService.list();
        return R.ok().data("items",teachers);
    }
}

